﻿// Calib_GetCorners_Dlg.cpp: 实现文件
//

#include "pch.h"
#include "SakerProject.h"
#include "Calib_GetCorners_Dlg.h"
#include "afxdialogex.h"

#include "xxFileProcess.h"
#include "mmFile_Paras.h"




// CCalib_GetCorners_Dlg 对话框
CCalib_GetCorners_Dlg * m_Calib_GetCorners;

IMPLEMENT_DYNAMIC(CCalib_GetCorners_Dlg, CDialogEx)

CCalib_GetCorners_Dlg::CCalib_GetCorners_Dlg(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_Calib_GetCorners, pParent)
{

}

CCalib_GetCorners_Dlg::~CCalib_GetCorners_Dlg()
{
}

void CCalib_GetCorners_Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CCalib_GetCorners_Dlg, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON_Save, &CCalib_GetCorners_Dlg::OnBnClickedButtonSave)
END_MESSAGE_MAP()


// CCalib_GetCorners_Dlg 消息处理程序


BOOL CCalib_GetCorners_Dlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	mmCalib.CornerPara.RCorners = xx::InitWidget(this, IDC_EDIT_RCorners, mmCalib.iniField, L"RCorners", mmFile_Paras.iniModelPath(), 0);
	mmCalib.CornerPara.CCorners = xx::InitWidget(this, IDC_EDIT_CCorners, mmCalib.iniField, L"CCorners", mmFile_Paras.iniModelPath(), 0);
	mmCalib.CornerPara.RSquare = xx::InitWidget(this, IDC_EDIT_RSquare, mmCalib.iniField, L"RSquare", mmFile_Paras.iniModelPath(), 0.0);
	mmCalib.CornerPara.CSquare = xx::InitWidget(this, IDC_EDIT_CSquare, mmCalib.iniField, L"CSquare", mmFile_Paras.iniModelPath(), 0.0);
	mmCalib.WaitGetCorners = xx::InitWidget(this, IDC_EDIT_WaitGetCorners, mmCalib.iniField, L"WaitGetCorners", mmFile_Paras.iniModelPath(), 0);
	mmCalib.cutWidth = xx::InitWidget(this, IDC_EDIT_cutWidth, mmCalib.iniField, L"cutWidth", mmFile_Paras.iniModelPath(), mmCalib.cutWidth);
	mmCalib.SpecCOV = xx::InitWidget(this, IDC_EDIT_SpecCOV, mmCalib.iniField, L"SpecCOV", mmFile_Paras.iniModelPath(), mmCalib.SpecCOV);
	mmCalib.CornerCOV = xx::InitWidget(this, IDC_EDIT_CornerCOV, mmCalib.iniField, L"CornerCOV", mmFile_Paras.iniModelPath(), mmCalib.CornerCOV);

	mmCalib.Flag_SaveSourceFig = xx::InitCK(this, IDC_CHECK_SaveSourceFig, mmCalib.iniField, L"SaveSourceFig", mmFile_Paras.iniModelPath(), false);
	mmCalib.Apply_SubPixMethod = xx::InitCK(this, IDC_CHECK_SubPixMethod, mmCalib.iniField, L"SubPixMethod", mmFile_Paras.iniModelPath(), false);
	mmCalib.Apply_ModifyCorners = xx::InitCK(this, IDC_CHECK_ModifyCorners, mmCalib.iniField, L"ModifyCorners", mmFile_Paras.iniModelPath(), false);

	return TRUE;
}


void CCalib_GetCorners_Dlg::OnBnClickedButtonSave()
{
	mmCalib.CornerPara.RCorners = xx::DefaultWidget(this, IDC_EDIT_RCorners, mmCalib.iniField, L"RCorners", mmFile_Paras.iniModelPath(), 0);
	mmCalib.CornerPara.CCorners = xx::DefaultWidget(this, IDC_EDIT_CCorners, mmCalib.iniField, L"CCorners", mmFile_Paras.iniModelPath(), 0);
	mmCalib.CornerPara.RSquare = xx::DefaultWidget(this, IDC_EDIT_RSquare, mmCalib.iniField, L"RSquare", mmFile_Paras.iniModelPath(), 0.0);
	mmCalib.CornerPara.CSquare = xx::DefaultWidget(this, IDC_EDIT_CSquare, mmCalib.iniField, L"CSquare", mmFile_Paras.iniModelPath(), 0.0);
	mmCalib.WaitGetCorners = xx::DefaultWidget(this, IDC_EDIT_WaitGetCorners, mmCalib.iniField, L"WaitGetCorners", mmFile_Paras.iniModelPath(), 0);
	mmCalib.cutWidth = xx::DefaultWidget(this, IDC_EDIT_cutWidth, mmCalib.iniField, L"cutWidth", mmFile_Paras.iniModelPath(), mmCalib.cutWidth);
	mmCalib.SpecCOV = xx::DefaultWidget(this, IDC_EDIT_SpecCOV, mmCalib.iniField, L"SpecCOV", mmFile_Paras.iniModelPath(), mmCalib.SpecCOV);
	mmCalib.CornerCOV = xx::DefaultWidget(this, IDC_EDIT_CornerCOV, mmCalib.iniField, L"CornerCOV", mmFile_Paras.iniModelPath(), mmCalib.CornerCOV);

	mmCalib.Flag_SaveSourceFig = xx::DefaultCK(this, IDC_CHECK_SaveSourceFig, mmCalib.iniField, L"SaveSourceFig", mmFile_Paras.iniModelPath());
	mmCalib.Apply_SubPixMethod = xx::DefaultCK(this, IDC_CHECK_SubPixMethod, mmCalib.iniField, L"SubPixMethod", mmFile_Paras.iniModelPath());
	mmCalib.Apply_ModifyCorners = xx::DefaultCK(this, IDC_CHECK_ModifyCorners, mmCalib.iniField, L"ModifyCorners", mmFile_Paras.iniModelPath());

}
